# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  include TagsHelper

  def show_tab
    if session['tab'] == 1 
      @tab1 = 'current_tab'
    elsif session['tab'] == 2
      @tab2 = 'current_tab'
    elsif session['tab'] == 3
      @tab3 = 'current_tab'
    elsif session['tab'] == 4
      @tab4 = 'current_tab'
    else
      #    默认情况下标签1为默认的标签
      @tab1 = 'current_tab'
    end
    return ""
  end  
  
  def date_format(date)
    date.strftime("%Y年%m月%d日 %H:%M:%S")
  end
  
  def check_admin
    session[:user]&&session[:user].is_admin
  end
end
